package com.xt.base.service;

import java.io.Serializable;

import org.apache.log4j.Logger;

import com.xt.base.dao.hibernate.BaseDaoHibernate;

/**
 * Base class for Business Services .
 * 
 * <p>
 * <a href="BaseService.java.html"><i>查看</i></a>
 * </p>
 * 
 * @author 杨洪波
 */
public abstract class BaseService implements Serializable {
	private static final long serialVersionUID = -6907016058600729849L;
	protected final Logger log = Logger.getLogger(this.getClass());

	abstract public BaseDaoHibernate getDao();

	@SuppressWarnings("unchecked")
	public Object get(Class clazz,Long id) {
		return getDao().getObject(clazz, id);
	}

	@SuppressWarnings("unchecked")
	public Object get(Class clazz,String code) {
		return getDao().getObject(clazz, code);
	}

	public void save(Object o) {
		getDao().save(o);
	}

	public void removeById(Class clazz,Serializable id) {
		getDao().removeById(clazz,id);
	}

	public void remove(Object o) {
		getDao().remove(o);
	}
	
	 public String getCurrentPath(){
			return this.getClass().getClassLoader().getResource("").getPath();
	}
}
